﻿using HoverTree.IDAL;
using HoverTree.Model;
using System.Collections.Generic;

namespace HoverTree.BLL
{
    public class HvtImageSet
    {
        static readonly IImageSet dal = DALFactory.DataAccess.CreateImageSet();
        public string Add(ImageSetInfo info)
        {
            return dal.Add(info);
        }

        public List<ImageSetInfo> HvtPageQuery(ImageSetSelect select, int sortType, int pageSize, int pageIndex, out int totalCount, out int totalPageCount)
        {
            return dal.HvtPageQuery(select, sortType, pageSize, pageIndex, out totalCount, out totalPageCount);
        }

        public ImageSetInfo GetByID(int hvtID)
        {
            ImageSetSelect m_select = new ImageSetSelect();
            m_select.HvtID = hvtID;

            return Get(m_select);
        }

        public ImageSetInfo GetByName(string name)
        {
            ImageSetSelect m_select = new ImageSetSelect();
            m_select.HvtName = name;

            return Get(m_select);
        }
        public ImageSetInfo Get(ImageSetSelect select)
        {
            return dal.Get(select);
        }

        public string Alter(ImageSetInfo info)
        {
            if (string.IsNullOrEmpty(info.HvtName))
                info.HvtName = "";
            return dal.Alter(info);
        }

        public string Delete(int hvtid)
        {
            return dal.Delete(hvtid);
        }
    }
}